package md.mru.core.domains.administration;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Set;

/**
 * @author sergiu.marin
 * @since 14.04.2014.
 */
@Entity
@Table(name = "tree_node_models", schema = "c##mru_optimized")
public class TreeNodeModel implements Serializable {

    private static final long serialVersionUID = 7480582709796744431L;

    @Id
    @Column(name = "id", unique = true, nullable = false, precision = 10, scale = 0)
    @GeneratedValue(generator = "tm_sequence")
    @SequenceGenerator(name = "tm_sequence", sequenceName = "tree_node_model_sequence", allocationSize = 1)
    private long id;

    @ManyToOne
    @JoinColumn(name = "parent_node_id")
    private TreeNodeModel parentNode;

    private String name;

    private String description;

    @Column(name = "position", columnDefinition = "BINARY_DOUBLE")
    private Double position;

    @ManyToOne
    @JoinColumn(name = "tree_node_type_id")
    private TreeNodeType treeNodeType;     // tre.tre_tpe - nml_fnc

    @OneToMany(mappedBy = "id.treeNodeModel", cascade = CascadeType.ALL)
    private Set<TreeModelUserGroup> groups;

    @OneToMany(mappedBy = "id.treeNodeModel", cascade = CascadeType.ALL)
    private Set<TreeFolder> treeFolders;

    @Column(name = "phone_no")
    private String phoneNo;

    @Column(name = "office_location")
    private String officeLocation;

    /*@Column(name = "phone_no_2")
    private String phoneNo2;

    @Column(name = "phone_no_3")
    private String phoneNo3;*/

    /*@Column(name = "validate_from")
    private Date validateFrom;

    @Column(name = "validate_to")
    private Date validateTo;*/

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public TreeNodeModel getParentNode() {
        return parentNode;
    }

    public void setParentNode(TreeNodeModel parentNode) {
        this.parentNode = parentNode;
    }

    public String getName() {
        return name;
    }

    public void setName(String nme) {
        this.name = nme;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String dsc) {
        this.description = dsc;
    }

    public Double getPosition() {
        return position;
    }

    public void setPosition(Double fvr) {
        this.position = fvr;
    }

    public TreeNodeType getTreeNodeType() {
        return treeNodeType;
    }

    public void setTreeNodeType(TreeNodeType treeNodeType) {
        this.treeNodeType = treeNodeType;
    }

    public Set<TreeModelUserGroup> getGroups() {
        return groups;
    }

    public void setGroups(Set<TreeModelUserGroup> groups) {
        this.groups = groups;
    }

    public String getPhoneNo() {
        return phoneNo;
    }

    public void setPhoneNo(String phoneNo) {
        this.phoneNo = phoneNo;
    }

    public String getOfficeLocation() {
        return officeLocation;
    }

    public void setOfficeLocation(String officeLocation) {
        this.officeLocation = officeLocation;
    }

    /*    public String getPhoneNo() {
        return phoneNo1;
    }

    public void setPhoneNo(String tel1) {
        this.phoneNo1 = tel1;
    }

    public String getPhoneNo2() {
        return phoneNo2;
    }

    public void setPhoneNo2(String tel2) {
        this.phoneNo2 = tel2;
    }

    public String getPhoneNo3() {
        return phoneNo3;
    }

    public void setPhoneNo3(String tel3) {
        this.phoneNo3 = tel3;
    }*/

    /*public Date getValidateFrom() {
        return validateFrom;
    }

    public void setValidateFrom(Date vldFrm) {
        this.validateFrom = vldFrm;
    }

    public Date getValidateTo() {
        return validateTo;
    }

    public void setValidateTo(Date vldTo) {
        this.validateTo = vldTo;
    }*/

    public Set<TreeFolder> getTreeFolders() {
        return treeFolders;
    }

    public void setTreeFolders(Set<TreeFolder> treeFolders) {
        this.treeFolders = treeFolders;
    }
}
